import fetch from "@/api/fetch"
import constants from "@/api/constants"

const baseURL = constants.baseURL + "/member/cart";

const api = {
    // 购物车
    cart: {
        // 列表
        list(memberId) {
            return fetch.get(baseURL + "/list/" + memberId);
        },
        // 添加购物车
        addCart(memberId, skuId, quantity) {
            return fetch.post(baseURL + "/addCart?memberId=" + memberId + "&skuId=" + skuId + "&quantity=" + quantity);
        },
        // 更新购物车
        updateCart(id, quantity) {
            return fetch.post(baseURL + "/updateCart?id=" + id + "&quantity=" + quantity)
        },
        // 删除购物车
        deleteCart(cartIds) {
            return fetch.post(baseURL + "/deleteCart", cartIds)
        }
    }
}

export default api;